define(function(require) {
	
	var $ = require("jquery1.7");
	
	var utils = require("utils");
	var ctx = utils.constants.ctx;
	
	//初始表格
	var table = layui.table;
	var tablelin = table.render({
	    elem: '#demo'
	    ,url : '/back/base/userLogData'
	    ,cols: [[ //标题栏
	      {field: 'index', title: '序号', width: 80}
	      ,{field: 'user', title: '昵称', width: 120}
	      ,{field: 'userid', title: '用户Id', width: 80}
	      ,{field: 'description', title: '日志详情', width: 220}
	      ,{field: 'methods', title: '调用方法', width: 400}
	      ,{field: 'creatDate', title: '时间', width: 150}
	    ]] 
	    ,even: true
	    ,page: true //是否显示分页
	    ,limits: [8, 12, 15,18]
	    ,limit: 15 //每页默认显示的数量
	    ,id: "test"
	  });
	
	//时间插件初始化
	var laydate = layui.laydate;
	  
	  //执行一个laydate实例
	  laydate.render({
	    elem: '#dateRange' //指定元素
	    ,range: true
	  });
	
	//重载表格事件
	$(document).on("click","#searchBtn",function(){
		var begin = "";
		var end = "";
		if($("#dateRange").val()!=""){
			begin = $("#dateRange").val().split(" - ")[0]
			end = $("#dateRange").val().split(" - ")[1]
		}
		var param = {
				beginTime:begin,
				endTime:end,
				userName:$("#search_input").val()
		}
		tablelin.reload({
			where:param
		});
	})
	
});